import request from '@/utils/request'

// 商品类型搜索
export const getGoodsType = (params) => {
  return request({
    url: '/api/vm-service/skuClass/search',
    method: 'GET',
    params
  })
}
// 商品类型搜索1
export const getGoodsType1 = () => {
  return request({
    url: 'api/vm-service/skuClass/search?pageIndex=1&pageSize=100000',
    method: 'GET'
  })
}

// 商品搜索
export const getGoods = (params) => {
  return request({
    url: '/api/vm-service/sku/search',
    params
  })
}

// 删除商品类型
export const delGoods = (classId) => {
  return request({
    url: `/api/vm-service/skuClass/${classId}`,
    method: 'DELETE'
  })
}

// 新增商品类型
export const getNewType = (data) => {
  return request({
    url: '/api/vm-service/skuClass',
    method: 'POST',
    data
  })
}

// 修改商品类型
export const editGoodsType = (classId, data) => {
  return request({
    url: `/api/vm-service/skuClass/${classId}`,
    method: 'PUT',
    data
  })
}

// 新增商品
export const addGoods = (data) => {
  return request({
    url: '/api/vm-service/sku',
    method: 'post',
    data
  })
}

// 上传所有商品信息
export const addAll = (data) => {
  return request({
    url: 'api/vm-service/sku',
    method: 'POST',
    data
  })
}

// 修改商品
export const editGoods = (data, skuId) => {
  return request({
    url: `/api/vm-service/sku/${skuId}`,
    method: 'put',
    data
  })
}
